<?php
/**
 * Esta classe factory do DB
 * @category   Fencer
 * @package    Fencer_Model
 */

class Fencer_Model_Factory{

	private $_db = null;
	private static $_instance = null;
	
	/**
	 * 
	 * @return Fencer_Model_Factory
	 */
	public static function getInstance(){
		
		
		if(!isset(self::$_instance)){
			self::$_instance = new Fencer_Model_Factory();
		}
		return self::$_instance;
	}
	
	private function __construct(){
		if($this->_db == null){
			$this->_db = Zend_Db_Table::getDefaultAdapter();
		}
	}
	
	/**
	 * 
	 * @return Zend_Db_Adapter_Pdo_Pgsql
	 */
	public function getDb(){
		return $this->_db;
	}
	
	public function beginTransaction(){
		$db = $this->getDb();
		$db->beginTransaction();
		
	}
	
	public function commit(){
		$db = $this->getDb();
		$db->commit();
		
	}
	
	public function rollBack(){
		$db = $this->getDb();
		$db->rollBack();
		
	}


}
